package com.api.predict.form;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author RenQiang
 * @date 2021/6/5
 */
@Data
@ApiModel(value = "联赛创建表单")
public class CreatePredictForm {
    @ApiModelProperty(value = "predict id")
    private Long id;
    @ApiModelProperty(value = "竞猜海报")
    @NotEmpty
    private String poster;
    @ApiModelProperty(value = "置顶海报（轮播图）")
    private String carousel;
    @ApiModelProperty(value = "竞猜标题")
    @NotEmpty
    private String title;
    @ApiModelProperty(value = "游戏ID")
    @NotNull
    private Long gameId;
    @ApiModelProperty(value = "开始时间")
    @NotNull
    private Date startTime;
    @ApiModelProperty(value = "结束时间")
    @NotNull
    private Date endTime;
    @ApiModelProperty(value = "保底奖金额度", notes = "若没有保底奖金则填0")
    @NotNull
    @Min(value = 0)
    private BigDecimal prizeAmount;
    @ApiModelProperty(value = "参与竞猜的费用（每注）")
    @NotNull
    @Min(value = 1)
    private BigDecimal registrationFee;
    @ApiModelProperty(value = "赛事视频链接")
    private String videoLink;
    @ApiModelProperty(value = "竞猜规则")
    @NotEmpty
    private String termsAndCondition;
    @ApiModelProperty(value = "平台抽成百分比")
    @NotNull
    @Range(min = 0, max = 1)
    private BigDecimal commissionRate;
    @ApiModelProperty(value = "参与竞猜时需要选择的队伍数量")
    @NotNull
    @Min(value = 1)
    private Integer predictTeamCount;
    @Valid
    @NotEmpty
    @ApiModelProperty(value = "竞猜可选战队列表")
    private List<PredictTeamForm> predictTeams;

    @Data
    public static class PredictTeamForm {
        @NotEmpty
        @ApiModelProperty(value = "竞猜战队名称")
        private String teamName;
        @NotEmpty
        @ApiModelProperty(value = "竞猜战队Logo")
        private String teamLogo;
        @NotEmpty
        @ApiModelProperty(value = "竞猜战队描述")
        private String teamDescription;
    }
}
